package com.bclz.baseLearn

class FirstClass(real: Double, imaginary: Double) {
  def re() = real
  def im() = imaginary
  
  
  
}

class FirstClass2(real: Double, imaginary: Double) {
  def re = real
  def im = imaginary
  
  override def toString()=re+(if(im<0) "-" else "+")+im+"i"
}

object Test1{
  
  
  def main(args:Array[String]){
    
    val c=new FirstClass(1d,2d)
    
    println(c.re())
    
    val d=new FirstClass2(1d,2d)
    
    println(d.re)
    println(d.toString())
    
    val arr=Array("hello world","hello world","hello xuchang","string Integer","hello string")
    println(arr.flatMap(_.split(" ")).map((_,1)).groupBy(_._1).map(t=>(t._1,t._2.length)).toList)
  }
  
}